﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Virtualisation
{
    class Program
    {
        static void Main(string[] args)
        {
            ClasseMere ObjM = new ClasseMere();
            ClasseFille ObjF = new ClasseFille();
            ObjM.f(5);
            Console.WriteLine("ObjM.f(5) : X = " + ObjM.x);
            ObjM.g(5, 9);
            Console.WriteLine("ObjM.g(5, 9) : X = " + ObjM.x);
            ObjF.f(5);
            Console.WriteLine("ObjF.f(5) : X = " + ObjM.x);
            ObjM.g(5, 9);
            Console.WriteLine("ObjF.g(5, 9) : X = " + ObjM.x);
        }
    }
    class ClasseMere
    {
        public int x = 10;
        public virtual void f(int a)
        { x += a; }
        public virtual void g(int a, int b)
        { x += a * b; }
    }
    class ClasseFille : ClasseMere
    {
        int y = 20;
        public override void f(int a) // redéfinition
        {
            x *= a;
        }
        public void g(char b) // surcharge de g
        { x += b * y; }
    }
}
